package com.demo.petshop.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

@Service
public class EmailService {
    @Autowired
    private JavaMailSender javaMailSender;

    public void sendVerificationCode(String email, String code) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("2248244079@qq.com");
        message.setTo(email);
        message.setSubject("注册验证码");
        message.setText("您的注册验证码是: " + code + "，请在5分钟内完成验证。");
        javaMailSender.send(message);
    }
}
